//
//  MineStore.m
//  NewPro
//
//  Created by RYX on 2018/10/29.
//  Copyright © 2018年 何荧红. All rights reserved.
//

#import "MineStore.h"
#import "UserModel.h"

@implementation MineStore

#pragma mark - 获取用户信息
- (void)getUserInfoWithCustomId:(NSString *)customId Success:(void(^)(UserModel *model))success Failure:(void(^)(NSError *error))failure{
    
    
    NSString *url = [NSString stringWithFormat:@"%@/api/custom/settlementIncome",IP];
    
    NSDictionary *dic = @{
                          @"customId":customId
                          };
    
    [HttpTool postUrlWithString:url parameters:dic success:^(id responseObject) {
        
        NSError *error = [HttpTool inspectError:responseObject];
        
        if (error == nil) {
            
            UserModel *model = [UserModel mj_objectWithKeyValues:responseObject[@"data"][@"custom"]];
            model.readnum = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"readnum"]];
            success(model);
            
        }else{
            
            failure(error);
        }
        
    } failure:^(NSError *error) {
       
        NSLog(@"报错了======%@",[[NSString alloc] initWithData:error.userInfo[@"com.alamofire.serialization.response.error.data"] encoding:NSUTF8StringEncoding]);
        failure(error);
    }];
}


@end
